var app = new Vue({
  el: '#app',
  // data:{
  //   ajdatas:{
  //     lists:[],
  //     guofa:[],
  //     ziyuan:[],
  //     zuozhe:[],
  //     chuban:[]
  //   }
  // },
  data: {
    search:{
      way:'',
      keywords:'',
      orderType:'default',
      orderVal:'desc',
      page:10,
    },
    cateVal:{
      guofa:{},
      ziyuan:{},
      zuozhe:{},
      chuban:{}
    },
    show:{
      guofa:0,
      ziyuan:0,
      zuozhe:0,
      chuban:0
    },
    dateSelect:{
      min:'',
      max:''
    },
    ajdatas:{
      lists:[
        {
          img:'img/tu2.jpg',
          title:'曾繁仁文集：1—5卷　第二卷：生态存在论美学论稿',
          url:'http://www.baidu.com'
        }
      ],
      guofa:[
        {
          name: "马克思主义、列宁主义、毛泽东思想、邓小平理论",
          count:2222,
          value:555,
          level:1,
          child:[
            {
              name: "马克思、恩格斯著作",
              count:2222,
              value:30,
              level:2,
              child:[
                {
                  name: "选集、文集",
                  count:2222,
                  value:40,
                  level:3,
                  child:[
                    {
                      name: "选读",
                      count:2222,
                      value:60,
                      level:4,
                    },
                  ]
                },
                {
                  name: "单行著作",
                  count:2222,
                  value:41,
                  level:3,
                  child:[
                    {
                      name: "马克思主义形成时期（1848年以前）",
                      count:2222,
                      value:50,
                      level:4,
                    },
                    {
                      name: "革命风暴的高涨与低落时期（1848~1863年）",
                      count:2222,
                      value:51,
                      level:4,
                    },
                    {
                      name: "第一国际和巴黎公社时期（1864~1872年）",
                      count:2222,
                      value:52,
                      level:4,
                    },
                    {
                      name: "马克思主义广泛传播和各国建立社会主义政党时期（1873~1889年6月）",
                      count:2222,
                      value:53,
                      level:4,
                    },
                  ]
                },
                {
                  name: "书信集、日记、函电、谈话",
                  count:2222,
                  value:42,
                  level:3,
                },
                {
                  name: "诗词",
                  count:2222,
                  value:43,
                  level:3,
                },
                {
                  name: "手迹",
                  count:2222,
                  value:44,
                  level:3,
                },
                {
                  name: "专题汇编",
                  count:2222,
                  value:45,
                  level:3,
                },
                {
                  name: "语录",
                  count:2222,
                  value:46,
                  level:3,
                }
              ]
            },
            {
              name: "列宁著作",
              count:2222,
              value:31,
              level:2,
            },
            {
              name: "斯大林著作",
              count:2222,
              value:32,
              level:2,
            },
            {
              name: "毛泽东著作",
              count:2222,
              value:33,
              level:2,
            },
            {
              name: "邓小平著作",
              count:2222,
              value:34,
              level:2,
            },
            {
              name: "马克思、恩格斯、列宁、斯大林、毛泽东、邓小平著作汇编",
              count:2222,
              value:35,
              level:2,
            },
            {
              name: "马克思、恩格斯、列宁、斯大林、毛泽东、邓小平生平和传记",
              count:2222,
              value:36,
              level:2,
            },
            {
              name: "马克思主义、列宁主义、毛泽东思想、邓小平理论的学习和研究",
              count:2222,
              value:37,
              level:2,
            }
          ]
        },
        {
          name: "哲学、宗教",
          count:223,
          value:1222,
          level:1,
        },
        {
          name: "社会科学总论",
          count:223,
          value:2,
          level:1,
          child:[
            {
              name: "测试一下",
              count:2222,
              value:130,
              level:2,
            },
            {
              name: "测试一下2",
              count:2222,
              value:131,
              level:2,
            }
          ]
        },
        {
          name: "政治、法律",
          count:223,
          value:3555,
          level:1,
        },
        {
          name: "军事",
          count:223,
          value:4666,
          level:1,
        },
        {
          name: "经济",
          count:223,
          value:5777,
          level:1,
        },
        {
          name: "文化科学、教育、体育",
          count:223,
          value:6888,
          level:1,
        },
        {
          name: "语言、文字",
          count:223,
          value:7999,
          level:1,
        },
        {
          name: "文学",
          count:223,
          value:8000,
          level:1,
        },
        {
          name: "艺术",
          count:223,
          value:9000,
          level:1,
        },
        {
          name: "历史、地理",
          count:223,
          value:1098,
          level:1,
        },
        {
          name: "自然科学总论",
          count:223,
          value:1167,
          level:1,
        },
        {
          name: "数理科学和化学",
          count:223,
          value:1452,
          level:1,
        },
        {
          name: "综合性图书",
          count:223,
          value:1873,
          level:1,
        }
      ],
      ziyuan:[
        {
          name: "图书",
          count:223,
          value:1451,
          level:1,
        },
        {
          name: "报纸",
          count:223,
          value:342,
          level:1,
        },
        {
          name: "期刊",
          count:223,
          value:38,
          level:1,
        },
        {
          name: "多媒体",
          count:223,
          value:4678,
          level:1,
        }
      ],
      zuozhe:[
        {
          name: "湖南省湘学研究院",
          count:223,
          value:5,
          level:1,
        },
        {
          name: "宗教吉林大学哲学基础理论研究中心学",
          count:223,
          value:6,
          level:1,
        },
        {
          name: "[德]黑格尔",
          count:223,
          value:7,
          level:1,
        },
        {
          name: "包利民",
          count:223,
          value:8,
          level:1,
        },
        {
          name: "荆三隆",
          count:223,
          value:9,
          level:1,
        },
        {
          name: "王伟光",
          count:223,
          value:10,
          level:1,
        },
        {
          name: "李承贵",
          count:223,
          value:11,
          level:1,
        }
      ],
      chuban:[
        {
          name: "2020",
          count:223,
          value:1,
          level:1,
        },
        {
          name: "2019",
          count:223,
          value:2,
          level:1,
        },
        {
          name: "2018",
          count:223,
          value:3,
          level:1,
        },
        {
          name: "2017",
          count:223,
          value:4,
          level:1,
        },
        {
          name: "2016",
          count:223,
          value:5,
          level:1,
        },
        {
          name: "2015",
          count:223,
          value:6,
          level:1,
        },
        {
          name: "2014",
          count:223,
          value:7,
          level:1,
        },
      ],
      testdata: [
        {
          name: "菜单1",
          level:1,
        },
        {
          name: "菜单1",
          level:1,
        },
        {
          name: "菜单1",
          level:1,
          child: [
            {
              name: '菜单2',
              level:2,
              child: [
                {
                  name: '菜单3',
                  level:3
                },
              ]
            },
            {
              name: '菜单2',
              level:2,
              child: [
                {
                  name: '菜单3',
                  level:3,
                  child: [
                    {
                      name: '菜单4',
                      level:4
                    },
                  ]
                },
                {
                  name: '菜单3',
                  level:3,
                  child: [
                    {
                      name: '菜单4',
                      level:4,
                      child: [
                        {
                          name: '菜单5',
                          level:5
                        },
                      ]
                    },
                  ]
                }
              ]
            },
          ]
        }
      ],
    }
  },
  //生命周期-创建
  created: function () {
    this.show={
      guofa:1,
      ziyuan:1,
      zuozhe:1,
      chuban:1
    };
  },
  //生命周期-挂载后
  mounted: function () {
    $('.shareGroup').share();
  },
  methods: {
    //分类点击显示隐藏
    cateToggle:function (e) {
      this.show[e]=this.show[e] ? 0 : 1;
    },
    //组件传来的值
    cateChange:function(e) {
      Vue.set(this.cateVal[e.field], 'level'+(e.value.level-1), e.value.value)
      console.log('测组件传来的值：',e);
    },
    //排序点击
    orderChange:function (e) {
      if(this.search.orderType==e){
        this.search.orderVal=this.search.orderVal=='desc' ? 'asc' : 'desc';
      }else{
        this.search.orderType=e;
        this.search.orderVal='desc';
      }
      console.log(this.search.page);
    },
    // 每页显示点击
    pageChange:function () {
      console.log(this.search.page);
    },
    // 检索
    searchSubmit:function () {
      console.log(this.search.way,this.search.keywords);
    },
    // 清空
    searchReset:function () {
      console.log(this.search.way,this.search.keywords);
    },
    dateSubmit:function () {
      console.log(this.dateSelect);
    }
  }
})